{% extends "main/base.html" %}
{% load i18n main_tag %}
{% block title %}{% trans '客户' %}{% endblock %}
{% block content %}
<section class="panel">
    <header class="panel-heading">
        {% trans 'TechBrew 版本列表' %}
    </header>
    <div class="panel-body">
    {% get_current_language as LANGUAGE_CODE %}
        <div class="table-responsive panel-body widget-shadow">
            <table class="table">
                <thead>
                    <tr>
                        <th>{% trans '版本编号' %}</th>
                        <th>{% trans '中文名' %}</th>
                        <th>{% trans '英文名' %}</th>
                        <th>{% trans '首年价格' %}</th>
                        <th>{% trans '续费价格' %}</th>
                        <th>{% trans '中文介绍' %}</th>
                        <th>{% trans '英文介绍' %}</th>
                    </tr>
                </thead>
                <tbody>{% for d in version_data %}
                    <tr>
                        <td>{{ d.version_code }}</td>
                        <td>{{ d.version_name_cn }}</td>
                        <td>{{ d.version_name_en }}</td>
                        <td>{{ d.initial_price }}</td>
                        <td>{{ d.continue_price }}</td>
                        <td>{{ d.desc_cn }}</td>
                        <td>{{ d.desc_en }}</td>
                    </tr>{% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</section>
<section class="panel">
    <header class="panel-heading">
        {% trans 'TechBrew 客户列表' %}
    </header>
    <div class="panel-body">
    {% get_current_language as LANGUAGE_CODE %}
        <div class="table-responsive panel-body widget-shadow">
            <table class="table">
                <thead>
                    <tr>
                        <th>No.</th>
                        <th>{% trans '客户编号' %}</th>
                        <th>{% trans '公司名称' %}</th>
                        <th>{% trans '联系人' %}</th>
                        <th>{% trans '手机' %}</th>
                        <th>{% trans '版本' %}</th>
                        <th>{% trans '链接' %}</th>
                        <th>{% trans '开始使用' %}</th>
                        <th>{% trans '开始付费' %}</th>
                        <th>{% trans '付费到期' %}</th>
                    </tr>
                </thead>
                <tbody>{% for d in client_data %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ d.client_code }}</td>
                        <td>{{ d.company_name }}</td>
                        <td>{{ d.contact }}</td>
                        <td>{{ d.contact_mobile|mobile|default_if_none:'' }}</td>
                        <td>{{ d.current_version.version_name_cn }}</td>
                        <td><a href="{{ d.home_url }}" target="_blank">{{ d.home_url }}</a></td>
                        <td>{{ d.datetime_join|date:"Y-m-d" }}</td>
                        <td>{{ d.payment_start|date:"Y-m-d" }}</td>
                        <td>{{ d.next_payment|date:"Y-m-d" }}</td>
                    </tr>{% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</section>
<section class="panel">
    <header class="panel-heading">
        {% trans 'TechBrew 收款记录' %}
    </header>
    <div class="panel-body">
    {% get_current_language as LANGUAGE_CODE %}
        <div class="table-responsive panel-body widget-shadow">
            <table class="table">
                <thead>
                    <tr>
                        <th>{% trans '付款编号' %}</th>
                        <th>{% trans '客户名称' %}</th>
                        <th>{% trans '付款时间' %}</th>
                        <th>{% trans '金额' %}</th>
                        <th>{% trans '订单编号' %}</th>
                        <th>{% trans '备注' %}</th>
                        <th>{% trans '已经完成' %}</th>
                    </tr>
                </thead>
                <tbody>{% for d in pay_data %}
                    <tr>
                        <td>{{ d.client_payment_code }}</td>
                        <td>{{ d.techbrew_client.company_name }}</td>
                        <td>{{ d.payment_datetime }}</td>
                        <td>{{ d.amount }}</td>
                        <td>{{ d.order_code }}</td>
                        <td>{{ d.remark }}</td>
                        <td>{{ d.payed }}</td>
                    </tr>{% endfor %}
                </tbody>
            </table>
            <p align="right">{% trans '合计：' %}{{ total_payment.total_payment }}{% trans '元' %}</p>
        </div>
    </div>
</section>
<section class="panel">
    <header class="panel-heading">
        {% trans 'TechBrew 资金流水' %}
    </header>
    <div class="panel-body">
    {% get_current_language as LANGUAGE_CODE %}
        <div class="table-responsive panel-body widget-shadow">
            <table class="table">
                <thead>
                    <tr>
                        <th>{% trans 'ID' %}</th>
                        <th>{% trans '记录时间' %}</th>
                        <th>{% trans '相关付款记录' %}</th>
                        <th>{% trans '金额' %}</th>
                        <th>{% trans '描述' %}</th>
                        <th>{% trans '备注' %}</th>
                        <th>{% trans '已经确认' %}</th>
                    </tr>
                </thead>
                <tbody>{% for d in money_data %}
                    <tr>
                        <td>{{ d.pk }}</td>
                        <td>{{ d.record_datetime }}</td>
                        <td>{{ d.related_payment|default_if_none:'' }}</td>
                        <td>{{ d.amount }}</td>
                        <td>{{ d.desc }}</td>
                        <td>{{ d.remark|default_if_none:''|safe|linebreaks }}</td>
                        <td>{{ d.confirmed }}</td>
                    </tr>{% endfor %}
                </tbody>
            </table>
            <p align="right">{% trans '合计：' %}{{ total_left.total_left }}{% trans '元' %}</p>
        </div>
    </div>
</section>
{% endblock %}